<template>
<div>
<!--  <a-form-model-item label="旧用户名">-->
<!--    <a-input v-model="form.username" placeholder="请输入要修改的用户名" />-->
<!--  </a-form-model-item>-->
<!--  <a-form-model-item :wrapper-col="buttonItemLayout.wrapperCol">-->

    <a-form-model-item label="新用户名">
      <a-input v-model="form.new_user" placeholder="请输入修改后的用户名" />
    </a-form-model-item>

    <a-button @click="put">
      修&emsp;改
    </a-button>
  &emsp;&emsp;
    <a-button @click="get">
      获取结果
    </a-button>

<!--  </a-form-model-item>-->
</div>
</template>

<script>
export default {
  name: "detail_update_user",
  data(){
    return{
      form:{
        username: "",
        new_username:"",
        user_level:localStorage.getItem('user_level'),
        id:localStorage.getItem('id')
      }
    }
  },
  computed:{
    buttonItemLayout() {
      const { layout } = this.form;
      return layout === "horizontal"
        ? {
          wrapperCol: { span: 14, offset: 4 },
        }
        : {};
    },
  },
  methods:{
    get(){
      this.$axios.get("/z/getjob/?id="+this.form.id).then(res=>{
          alert(res.data.msg)
          console.log(res.data)
        })
    },
    put(){
      // this.$axios.put('/z/user/?id='+this.id+'&username='+this.username+'&password='+this.password)
      this.$axios.put("/z/updateuser/?id="+this.form.id, {
        new_user: this.form.new_user,
        user_level: this.form.user_level
      })
        .then(res=>{
          alert(res.data.msg)
          console.log(res.data)
        })
    }
  }
}
</script>

<style scoped>

</style>
